import { createStore, applyMiddleware,compose } from 'redux'
// 中间件。处理异步操作
import thunk from 'redux-thunk'

// 操作state的reducer函数
import reducer from './reducer'

const composeEnhancers = (typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose

export default createStore(
  reducer,
  // 可以看到redux插件的树状结构
  // window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
  composeEnhancers(applyMiddleware(thunk))
)